//
//  NationalStudyViewController.m
//  AoJi
//
//  Created by MinwenYi on 15-3-10.
//  Copyright (c) 2015年 xuanheng. All rights reserved.
//

#import "NationalStudyViewController.h"
#import "DataSingleTon.h"
@interface NationalStudyViewController ()<UIScrollViewDelegate>
{
    NSMutableArray *countryListArray;
    NSMutableArray *cityListArray;
    
    NSMutableDictionary *Imagedic;
    NSMutableDictionary *colordic;
    UIView *sectionView;
    NSMutableArray *btnArray;
    UIScrollView *baseScrollview;
    

}

@end

@implementation NationalStudyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.ctitleLabel.text=@"国际游学";
    
    
    countryListArray=[NSMutableArray array];
    countryListArray=[DataSingleTon shareDataSingleTon].countryList;
    
    cityListArray=[NSMutableArray array];
    cityListArray=[DataSingleTon shareDataSingleTon].cityList;
    
    NSArray *countryName=[NSArray arrayWithObjects: @"美国",@"英国", @"澳洲",@"加拿大", @"新西兰", @"欧洲",@"亚洲", nil];
    
    NSMutableArray *  countryImageArray=[NSMutableArray arrayWithObjects:@"meiguo.png",@"yingguo",@"aodaliya.png",
                                         @"jiananda.png",@"xinxilan.png",@"ozhou.png",@"yazhou.png",
                                         nil];
    
    
    
    NSMutableArray *  colorsArray=[NSMutableArray arrayWithObjects:
                                   [self getCorlor:@"ea6745"],[self getCorlor:@"4bb799"],[self getCorlor:@"e85043"],// 美 英 澳大利亚
                                   [self getCorlor:@"ad9fcc"],[self getCorlor:@"f0c95e"],[self getCorlor:@"e95874"],//加 新 欧洲 亚洲
                                   [self getCorlor:@"78a7d9"],nil];
    
    
    
    Imagedic=[NSMutableDictionary dictionaryWithObjects:countryImageArray forKeys:countryName];
    
    colordic=[NSMutableDictionary dictionaryWithObjects:colorsArray forKeys:countryName];
    
    [super viewDidLoad];
    
    kBlackContent;
    
    self.ctitleLabel.text=@"出国留学";
    
    sectionView=[[UIView alloc]initWithFrame:CGRectMake(0, self.headerHeight, MainHeight, 42)];
    sectionView.backgroundColor=kheadBgcolor;
    
    [self.view addSubview:sectionView];
    float itemWidth=(Mainwidth-3)/4;
    
    NSArray *strs=[NSArray arrayWithObjects:@"选择国家",@"热点活动",@"热点面试",@"留学资讯", nil];
    btnArray=[NSMutableArray array];
    for (int i=0; i<4; i++) {
        UIButton *barBtn=[[UIButton alloc]initWithFrame:CGRectMake(1.5+itemWidth*i, 2.5, itemWidth, 40)];
        if (i==0) {
            barBtn.selected=YES;
        }
        
        barBtn.titleLabel.font=kFirstSegFontNum;
        [barBtn setTitle:strs[i] forState:UIControlStateNormal];
        [barBtn setTitleColor:[self getCorlor:@"646464"] forState:UIControlStateNormal];
        [barBtn setTitleColor:[self getCorlor:@"e70012"] forState:UIControlStateSelected];
        barBtn.tag=i;
        [sectionView addSubview:barBtn];
        [barBtn addTarget:self action:@selector(clickTheBarBtn:) forControlEvents:UIControlEventTouchUpInside];
        [btnArray addObject:barBtn];
    }
    
    for (int i=0; i<3; i++) {
        UIView *yLabel=[[UIView  alloc]initWithFrame:CGRectMake(1.5+itemWidth*(i+1), 6, 1, 30)];
        yLabel.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"forginStudyfengjiexian-y.png"]];
        [sectionView addSubview:yLabel];
        
        
    }
    
    
    
    UIView *topLineview=[[UIView alloc]initWithFrame:CGRectMake(0,2, Mainwidth, 1)];
    topLineview.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"fengjiexian-x.png"]];
    [sectionView addSubview:topLineview];
    
    UIView *bottomLineview=[[UIView alloc]initWithFrame:CGRectMake(0, viewHeight(sectionView)-1, Mainwidth, 1)];
    [sectionView addSubview:bottomLineview];
    bottomLineview.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"fengjiexian-x.png"]];
    
    
    
    
    baseScrollview=[[UIScrollView alloc]initWithFrame:CGRectMake(0, viewBottom(sectionView), Mainwidth, MainHeight-viewBottom(sectionView))];
    
    
    baseScrollview.delegate=self;
    baseScrollview.showsVerticalScrollIndicator=NO;
    baseScrollview.pagingEnabled=YES;
    baseScrollview.contentSize=CGSizeMake(Mainwidth*4, 0);
    
    [self.view addSubview:baseScrollview];

    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
